package com.xiaoyu.client.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xiaoyu.client.R;


/**
 * @author jx
 * @date 创建时间 2018/8/31
 * @Description 是否修改手机号
 */
public class ModificationInfoDialog extends Dialog implements View.OnClickListener {

    private Context mContext;
    private View mContentView;
    private TextView mTxtCancel, mTxtModification;

    public ModificationInfoDialog(Context context) {
        super(context, R.style.BaseDialogStyle);
        this.mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }

    private void initView() {
        mContentView = LayoutInflater.from(mContext).inflate(R.layout.modification_info_dialog, null);
        mTxtCancel = mContentView.findViewById(R.id.phone_dialog_cancel);
        mTxtModification = mContentView.findViewById(R.id.phone_dialog_confirm);
        mTxtCancel.setOnClickListener(this);
        mTxtModification.setOnClickListener(this);
        setContentView(mContentView);
    }

    @Override
    public void onClick(View v) {
        if (v == mTxtCancel) {
            if (listenerDismiss != null) {
                listenerDismiss.OnModificationDismiss();
            }
        }
        if (v == mTxtModification) {//修改
            if (listener != null) {
                listener.OnModificationPhone();
            }
        }
    }

    public IModificationInfoListener listener;
    public IModificationInfoListenerDismiss listenerDismiss;

    public interface IModificationInfoListener {
        void OnModificationPhone();
    }

    public interface IModificationInfoListenerDismiss {
        void OnModificationDismiss();
    }

    public void setIModifcationInfo(IModificationInfoListener listener) {
        this.listener = listener;
    }

    public void setIModifcationInfoDismiss(IModificationInfoListenerDismiss listener) {
        this.listenerDismiss = listener;
    }
}
